package com.company.proxy.v03;

import java.util.Random;

public class Tank implements MoveAble {
/*
模拟坦克的移动时间
 */

    @Override
    public void move() {
        long start = System.currentTimeMillis();
        System.out.println("tank moving calacalacala");
        try {
            Thread.sleep(new Random().nextInt(10000));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        long end = System.currentTimeMillis();
        System.out.println("跑了" + (end - start) + "秒");
    }

    public static void main(String[] args) {
        new Tank2().move();
    }

    static class Tank2 extends Tank {
        @Override
        public void move() {
            long start = System.currentTimeMillis();
            super.move();
            long end = System.currentTimeMillis();
            System.out.println(end - start);
        }
    }

}

interface MoveAble {
    void move();
}